REST
REST API Model package for FuryStack
Generic concept
An ideal way to implement REST APIs in FuryStack is the following:
- Design the REST API - Create an interface that defines all endpoints, all requirements and all possible return values (~this package) You can place in a common module in a Monorepo that can be accessed both with the Backend and Frontend logic to share the API definition
- Implement the defined API endpoint using the interface on the backend service (~@furystack/rest-service)
- Import the predefined interface and use it on the client (@furystack/rest-client-fetch package)
- Be happy. Type safety can protect your ass if you do breaking changes with your REST API
Disclaimer
- Your service and client will be tightly coupled. However it can be beneficial if this is intentional but it doesn't fin in all REST API scenarios
- Validation doesn't come with type definitions by default - Type safety is compile-time only